package com.rs.game.player.dialogues;

import java.util.HashMap;

import com.rs.utils.Logger;

public final class DialogueHandler {

	private static final HashMap<Object, Class<Dialogue>> handledDialogues = new HashMap<Object, Class<Dialogue>>();

	@SuppressWarnings("unchecked")
	public static final void init() {
		try {
			handledDialogues.put("LevelUp", (Class<Dialogue>) Class.forName(LevelUp.class.getCanonicalName()));
			handledDialogues.put("ZarosAltar", (Class<Dialogue>) Class.forName(ZarosAltar.class.getCanonicalName()));
			handledDialogues.put("ClimbNoEmoteStairs", (Class<Dialogue>) Class.forName(ClimbNoEmoteStairs.class.getCanonicalName()));
			handledDialogues.put("Banker", (Class<Dialogue>) Class.forName(Banker.class.getCanonicalName()));
			handledDialogues.put("DestroyItemOption", (Class<Dialogue>) Class.forName(DestroyItemOption.class.getCanonicalName()));
			handledDialogues.put("FremennikShipmaster", (Class<Dialogue>) Class.forName(FremennikShipmaster.class.getCanonicalName()));
			handledDialogues.put("NexEntrance", (Class<Dialogue>) Class.forName(NexEntrance.class.getCanonicalName()));
			handledDialogues.put("MagicPortal", (Class<Dialogue>) Class.forName(MagicPortal.class.getCanonicalName()));
			handledDialogues.put("LunarAltar", (Class<Dialogue>) Class.forName(LunarAltar.class.getCanonicalName()));
			handledDialogues.put("AncientAltar", (Class<Dialogue>) Class.forName(AncientAltar.class.getCanonicalName()));
			handledDialogues.put("FletchingD", (Class<Dialogue>) Class.forName(FletchingD.class.getCanonicalName()));
			handledDialogues.put("RuneScapeGuide", (Class<Dialogue>) Class.forName(RuneScapeGuide.class.getCanonicalName()));
			handledDialogues.put("SurvivalExpert", (Class<Dialogue>) Class.forName(SurvivalExpert.class.getCanonicalName()));
			handledDialogues.put("SimpleMessage", (Class<Dialogue>) Class.forName(SimpleMessage.class.getCanonicalName()));
			handledDialogues.put("ItemMessage", (Class<Dialogue>) Class.forName(ItemMessage.class.getCanonicalName()));
			handledDialogues.put("ClimbEmoteStairs", (Class<Dialogue>) Class.forName(ClimbEmoteStairs.class.getCanonicalName()));
			handledDialogues.put("QuestGuide", (Class<Dialogue>) Class.forName(QuestGuide.class.getCanonicalName()));
			handledDialogues.put("GemCuttingD", (Class<Dialogue>) Class.forName(GemCuttingD.class.getCanonicalName()));
			handledDialogues.put("CookingD", (Class<Dialogue>) Class.forName(CookingD.class.getCanonicalName()));
			handledDialogues.put("HerbloreD", (Class<Dialogue>) Class.forName(HerbloreD.class.getCanonicalName()));
			handledDialogues.put("BarrowsD", (Class<Dialogue>) Class.forName(BarrowsD.class.getCanonicalName()));
			handledDialogues.put("SmeltingD", (Class<Dialogue>) Class.forName(SmeltingD.class.getCanonicalName()));
			handledDialogues.put("LeatherCraftingD", (Class<Dialogue>) Class.forName(LeatherCraftingD.class.getCanonicalName()));
			handledDialogues.put("EnchantedGemDialouge", (Class<Dialogue>) Class.forName(EnchantedGemDialouge.class.getCanonicalName()));
			handledDialogues.put("ForfeitDialouge", (Class<Dialogue>) Class.forName(ForfeitDialouge.class.getCanonicalName()));
			handledDialogues.put("Transportation", (Class<Dialogue>) Class.forName(Transportation.class.getCanonicalName()));
			handledDialogues.put("WildernessDitch", (Class<Dialogue>) Class.forName(WildernessDitch.class.getCanonicalName()));
			handledDialogues.put("SimpleNPCMessage", (Class<Dialogue>) Class.forName(SimpleNPCMessage.class.getCanonicalName()));
			handledDialogues.put("Transportation", (Class<Dialogue>) Class.forName(Transportation.class.getCanonicalName()));
			handledDialogues.put("DTSpectateReq", (Class<Dialogue>) Class.forName(DTSpectateReq.class.getCanonicalName()));
			handledDialogues.put("StrangeFace", (Class<Dialogue>) Class.forName(StrangeFace.class.getCanonicalName()));
			handledDialogues.put("AncientEffigiesD", (Class<Dialogue>) Class.forName(AncientEffigiesD.class.getCanonicalName()));
			handledDialogues.put("DTClaimRewards", (Class<Dialogue>) Class.forName(DTClaimRewards.class.getCanonicalName()));
			handledDialogues.put("SetSkills", (Class<Dialogue>) Class.forName(SetSkills.class.getCanonicalName()));
			handledDialogues.put("DismissD", (Class<Dialogue>) Class.forName(DismissD.class.getCanonicalName()));
			handledDialogues.put("MakeOverMage", (Class<Dialogue>) Class.forName(MakeOverMage.class.getCanonicalName()));
			handledDialogues.put("KaramjaTrip", (Class<Dialogue>) Class.forName(KaramjaTrip.class.getCanonicalName()));
			handledDialogues.put("DagonHai", (Class<Dialogue>) Class.forName(DagonHai.class.getCanonicalName()));
			handledDialogues.put("Ned", (Class<Dialogue>) Class.forName(Ned.class.getCanonicalName()));
			handledDialogues.put("Sakirth", (Class<Dialogue>) Class.forName(Sakirth.class.getCanonicalName()));
			handledDialogues.put("Bartender", (Class<Dialogue>) Class.forName(Bartender.class.getCanonicalName()));
			handledDialogues.put("MissionMaster", (Class<Dialogue>) Class.forName(MissionMaster.class.getCanonicalName()));
			handledDialogues.put("Klarense", (Class<Dialogue>) Class.forName(Klarense.class.getCanonicalName()));
			handledDialogues.put("MaxedPlayer", (Class<Dialogue>) Class.forName(MaxedPlayer.class.getCanonicalName()));
			handledDialogues.put("Morgan", (Class<Dialogue>) Class.forName(Morgan.class.getCanonicalName()));
			handledDialogues.put("Bouquet", (Class<Dialogue>) Class.forName(Bouquet.class.getCanonicalName()));
			handledDialogues.put("Veteran", (Class<Dialogue>) Class.forName(Veteran.class.getCanonicalName()));
			handledDialogues.put("MissionGive", (Class<Dialogue>) Class.forName(MissionGive.class.getCanonicalName()));
			handledDialogues.put("XPBook", (Class<Dialogue>) Class.forName(XPBook.class.getCanonicalName()));
			handledDialogues.put("Pikkupstix", (Class<Dialogue>) Class.forName(Pikkupstix.class.getCanonicalName()));
			handledDialogues.put("Frank", (Class<Dialogue>) Class.forName(Frank.class.getCanonicalName()));
			handledDialogues.put("DungeonTutorial", (Class<Dialogue>) Class.forName(DungeonTutorial.class.getCanonicalName()));
			handledDialogues.put("EstateAgent", (Class<Dialogue>) Class.forName(EstateAgent.class.getCanonicalName()));
			handledDialogues.put("SandwichLady", (Class<Dialogue>) Class.forName(SandwichLady.class.getCanonicalName()));
			handledDialogues.put("Starter", (Class<Dialogue>) Class.forName(Starter.class.getCanonicalName()));
			handledDialogues.put("MineShop", (Class<Dialogue>) Class.forName(MineShop.class.getCanonicalName()));
			handledDialogues.put("FlowerPickup", (Class<Dialogue>) Class.forName(FlowerPickup.class.getCanonicalName()));
			handledDialogues.put("clan_wars_view", (Class<Dialogue>) Class.forName(ClanWarsViewing.class.getCanonicalName()));
			handledDialogues.put("DiceBag", (Class<Dialogue>) Class.forName(DiceBag.class.getCanonicalName()));
			handledDialogues.put("Santa", (Class<Dialogue>) Class.forName(Santa.class.getCanonicalName()));
			handledDialogues.put("PartyRoomLever", (Class<Dialogue>) Class.forName(PartyRoomLever.class.getCanonicalName()));
			handledDialogues.put("DrogoDwarf", (Class<Dialogue>) Class.forName(DrogoDwarf.class.getCanonicalName()));
			handledDialogues.put("GeneralStore", (Class<Dialogue>) Class.forName(GeneralStore.class.getCanonicalName()));
			handledDialogues.put("Nurmof", (Class<Dialogue>) Class.forName(Nurmof.class.getCanonicalName()));
			handledDialogues.put("BootDwarf", (Class<Dialogue>) Class.forName(BootDwarf.class.getCanonicalName()));
			handledDialogues.put("MiningGuildDwarf", (Class<Dialogue>) Class.forName(MiningGuildDwarf.class.getCanonicalName()));
			handledDialogues.put("Man", (Class<Dialogue>) Class.forName(Man.class.getCanonicalName()));
			handledDialogues.put("Guildmaster", (Class<Dialogue>) Class.forName(Guildmaster.class.getCanonicalName()));
			handledDialogues.put("Scavvo", (Class<Dialogue>) Class.forName(Scavvo.class.getCanonicalName()));
			handledDialogues.put("Valaine", (Class<Dialogue>) Class.forName(Valaine.class.getCanonicalName()));
			handledDialogues.put("Hura", (Class<Dialogue>) Class.forName(Hura.class.getCanonicalName()));
			handledDialogues.put("TzHaarMejJal", (Class<Dialogue>) Class.forName(TzHaarMejJal.class.getCanonicalName()));
			handledDialogues.put("TzHaarMejKah", (Class<Dialogue>) Class.forName(TzHaarMejKah.class.getCanonicalName()));
			handledDialogues.put("LanderD", (Class<Dialogue>) Class.forName(LanderDialouge.class.getCanonicalName()));
			handledDialogues.put("MasterOfFear", (Class<Dialogue>) Class.forName(MasterOfFear.class.getCanonicalName()));
			handledDialogues.put("TokHaarHok", (Class<Dialogue>) Class.forName(TokHaarHok.class.getCanonicalName()));
			handledDialogues.put("NomadThrone", (Class<Dialogue>) Class.forName(NomadThrone.class.getCanonicalName()));
			handledDialogues.put("SimplePlayerMessage", (Class<Dialogue>) Class.forName(SimplePlayerMessage.class.getCanonicalName()));
			handledDialogues.put("BonfireD", (Class<Dialogue>) Class.forName(BonfireD.class.getCanonicalName()));
			handledDialogues.put("MasterChef", (Class<Dialogue>) Class.forName(MasterChef.class.getCanonicalName()));
			handledDialogues.put("FightKilnDialogue", (Class<Dialogue>) Class.forName(FightKilnDialogue.class.getCanonicalName()));
			handledDialogues.put("RewardChest", (Class<Dialogue>) Class.forName(RewardChest.class.getCanonicalName()));
			handledDialogues.put("WizardFinix", (Class<Dialogue>) Class.forName(WizardFinix.class.getCanonicalName()));
			handledDialogues.put("RunespanPortalD", (Class<Dialogue>) Class.forName(RunespanPortalD.class.getCanonicalName()));
			handledDialogues.put("SorceressGardenNPCs", (Class<Dialogue>) Class.forName(SorceressGardenNPCs.class.getCanonicalName()));
			handledDialogues.put("Marv", (Class<Dialogue>) Class.forName(Marv.class.getCanonicalName()));
			handledDialogues.put("FlamingSkull", (Class<Dialogue>) Class.forName(FlamingSkull.class.getCanonicalName()));
			handledDialogues.put("Hairdresser", (Class<Dialogue>) Class.forName(Hairdresser.class.getCanonicalName()));
			handledDialogues.put("Thessalia", (Class<Dialogue>) Class.forName(Thessalia.class.getCanonicalName()));
			handledDialogues.put("GrilleGoatsD", (Class<Dialogue>) Class.forName(GrilleGoatsDialogue.class.getCanonicalName()));
			handledDialogues.put("SlayerTeleports", (Class<Dialogue>) Class.forName(SlayerTeleports.class.getCanonicalName()));
			handledDialogues.put("SkillingTeleports", (Class<Dialogue>) Class.forName(SkillingTeleports.class.getCanonicalName()));
			handledDialogues.put("SummoningShop", (Class<Dialogue>) Class.forName(SummoningShop.class.getCanonicalName()));
			handledDialogues.put("Kuradal", (Class<Dialogue>) Class.forName(Kuradal.class.getCanonicalName()));
			handledDialogues.put("Training", (Class<Dialogue>) Class.forName(Training.class.getCanonicalName()));
			handledDialogues.put("Bossing", (Class<Dialogue>) Class.forName(Bossing.class.getCanonicalName()));
			handledDialogues.put("PrayerD", (Class<Dialogue>) Class.forName(PrayerD.class.getCanonicalName()));
			handledDialogues.put("PrayerD2", (Class<Dialogue>) Class.forName(PrayerD2.class.getCanonicalName()));
			handledDialogues.put("HomeGuide", (Class<Dialogue>) Class.forName(HomeGuide.class.getCanonicalName()));
			handledDialogues.put("Ajjat", (Class<Dialogue>) Class.forName(Ajjat.class.getCanonicalName()));
			handledDialogues.put("Harlan", (Class<Dialogue>) Class.forName(Harlan.class.getCanonicalName()));
			handledDialogues.put("Switching", (Class<Dialogue>) Class.forName(Switching.class.getCanonicalName()));
			handledDialogues.put("MuseumGuard", (Class<Dialogue>) Class.forName(MuseumGuard.class.getCanonicalName()));
			handledDialogues.put("JModTable", (Class<Dialogue>) Class.forName(JModTable.class.getCanonicalName()));
			handledDialogues.put("Achievements", (Class<Dialogue>) Class.forName(Achievements.class.getCanonicalName()));
			handledDialogues.put("Sawmill", (Class<Dialogue>) Class.forName(Sawmill.class.getCanonicalName()));
			handledDialogues.put("Nulodion", (Class<Dialogue>) Class.forName(Nulodion.class.getCanonicalName()));
			handledDialogues.put("DicingMaster", (Class<Dialogue>) Class.forName(DicingMaster.class.getCanonicalName()));
			handledDialogues.put("ModPanel", (Class<Dialogue>) Class.forName(ModPanel.class.getCanonicalName()));
			handledDialogues.put("TzHaarKet", (Class<Dialogue>) Class.forName(TzHaarKet.class.getCanonicalName()));
			handledDialogues.put("Artisan", (Class<Dialogue>) Class.forName(Artisan.class.getCanonicalName()));
			handledDialogues.put("MyAccount", (Class<Dialogue>) Class.forName(MyAccount.class.getCanonicalName()));
			handledDialogues.put("PvPTeleports", (Class<Dialogue>) Class.forName(PvPTeleports.class.getCanonicalName()));
			handledDialogues.put("ToolLeprechaun", (Class<Dialogue>) Class.forName(ToolLeprechaun.class.getCanonicalName()));
			handledDialogues.put("Home", (Class<Dialogue>) Class.forName(Home.class.getCanonicalName()));
			handledDialogues.put("MinnieCoop", (Class<Dialogue>) Class.forName(MinnieCoop.class.getCanonicalName()));
			handledDialogues.put("FredBinder", (Class<Dialogue>) Class.forName(FredBinder.class.getCanonicalName()));
			handledDialogues.put("DruidElementalist", (Class<Dialogue>) Class.forName(DruidElementalist.class.getCanonicalName()));
			handledDialogues.put("HeyPresto", (Class<Dialogue>) Class.forName(HeyPresto.class.getCanonicalName()));
			handledDialogues.put("WiseOldMan", (Class<Dialogue>) Class.forName(WiseOldMan.class.getCanonicalName()));
			handledDialogues.put("Azzanadra", (Class<Dialogue>) Class.forName(Azzanadra.class.getCanonicalName()));
			handledDialogues.put("MediumXPLamp", (Class<Dialogue>) Class.forName(MediumXPLamp.class.getCanonicalName()));
			handledDialogues.put("Char", (Class<Dialogue>) Class.forName(Char.class.getCanonicalName()));
			handledDialogues.put("Bob", (Class<Dialogue>) Class.forName(Bob.class.getCanonicalName()));
			handledDialogues.put("ItemDialogue", (Class<Dialogue>) Class.forName(ItemDialogue.class.getCanonicalName()));
			handledDialogues.put("StarSprite", (Class<Dialogue>) Class.forName(StarSprite.class.getCanonicalName()));
			handledDialogues.put("Droplog", (Class<Dialogue>) Class.forName(Droplog.class.getCanonicalName()));
			handledDialogues.put("Larry", (Class<Dialogue>) Class.forName(Larry.class.getCanonicalName()));
			handledDialogues.put("Warrior", (Class<Dialogue>) Class.forName(Warrior.class.getCanonicalName()));
			handledDialogues.put("Shamus", (Class<Dialogue>) Class.forName(Shamus.class.getCanonicalName()));
			handledDialogues.put("MonkOfEntrana", (Class<Dialogue>) Class.forName(MonkOfEntrana.class.getCanonicalName()));
			handledDialogues.put("Kamfreena", (Class<Dialogue>) Class.forName(Kamfreena.class.getCanonicalName()));
			handledDialogues.put("HouseTeleport", (Class<Dialogue>) Class.forName(HouseTeleport.class.getCanonicalName()));
			handledDialogues.put("LeaveHouse", (Class<Dialogue>) Class.forName(LeaveHouse.class.getCanonicalName()));
			handledDialogues.put("MakeChair", (Class<Dialogue>) Class.forName(MakeChair.class.getCanonicalName()));
			handledDialogues.put("MakeFire", (Class<Dialogue>) Class.forName(MakeFire.class.getCanonicalName()));
			handledDialogues.put("MakePortal", (Class<Dialogue>) Class.forName(MakePortal.class.getCanonicalName()));
			handledDialogues.put("MakeThrone", (Class<Dialogue>) Class.forName(MakeThrone.class.getCanonicalName()));
			handledDialogues.put("MakeTrees", (Class<Dialogue>) Class.forName(MakeTrees.class.getCanonicalName()));
			handledDialogues.put("MakeBook", (Class<Dialogue>) Class.forName(MakeBook.class.getCanonicalName()));
			handledDialogues.put("MakeAltar", (Class<Dialogue>) Class.forName(MakeAltar.class.getCanonicalName()));
			handledDialogues.put("CaptainLawgof", (Class<Dialogue>) Class.forName(CaptainLawgof.class.getCanonicalName()));
			handledDialogues.put("Lollk", (Class<Dialogue>) Class.forName(Lollk.class.getCanonicalName()));
			handledDialogues.put("Tanner", (Class<Dialogue>) Class.forName(Tanner.class.getCanonicalName()));
			handledDialogues.put("LoyaltyManager", (Class<Dialogue>) Class.forName(LoyaltyManager.class.getCanonicalName()));
			handledDialogues.put("Zimberfizz", (Class<Dialogue>) Class.forName(Zimberfizz.class.getCanonicalName()));
			handledDialogues.put("Teleporter", (Class<Dialogue>) Class.forName(Teleporter.class.getCanonicalName()));
			handledDialogues.put("Shops", (Class<Dialogue>) Class.forName(Shops.class.getCanonicalName()));
			handledDialogues.put("Voting", (Class<Dialogue>) Class.forName(Voting.class.getCanonicalName()));
			handledDialogues.put("Hans", (Class<Dialogue>) Class.forName(Hans.class.getCanonicalName()));
			handledDialogues.put("SwirlBirthday", (Class<Dialogue>) Class.forName(SwirlBirthday.class.getCanonicalName()));
			handledDialogues.put("CaptainJute", (Class<Dialogue>) Class.forName(CaptainJute.class.getCanonicalName()));
			handledDialogues.put("ChristmasCrackerD", (Class<Dialogue>) Class.forName(ChristmasCrackerD.class.getCanonicalName()));
			handledDialogues.put("ContestManager", (Class<Dialogue>) Class.forName(ContestManager.class.getCanonicalName()));
			handledDialogues.put("ArmadylBstaff", (Class<Dialogue>) Class.forName(ArmadylBstaff.class.getCanonicalName()));
			handledDialogues.put("DungRewardConfirm", (Class<Dialogue>) Class.forName(DungRewardConfirm.class.getCanonicalName()));
			handledDialogues.put("DungeonCompleteD", (Class<Dialogue>) Class.forName(DungeonCompleteD.class.getCanonicalName()));
			handledDialogues.put("DungeonExitD", (Class<Dialogue>) Class.forName(DungeonExitD.class.getCanonicalName()));
			handledDialogues.put("DungFloorSelectD", (Class<Dialogue>) Class.forName(DungFloorSelectD.class.getCanonicalName()));
			handledDialogues.put("BindItemD", (Class<Dialogue>) Class.forName(BindItemD.class.getCanonicalName()));


		} catch (Throwable e) {
			Logger.handle(e);
		}
	}

	public static final void reload() {
		handledDialogues.clear();
		init();
	}

	public static final Dialogue getDialogue(Object key) {
		if (key instanceof Dialogue)
			return (Dialogue) key;
		Class<Dialogue> classD = handledDialogues.get(key);
		if (classD == null)
			return null;
		try {
			return classD.newInstance();
		} catch (Throwable e) {
			Logger.handle(e);
		}
		return null;
	}

	private DialogueHandler() {

	}
}
